﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using AutoGear.BLL;


public partial class controls_admin_cms_edit : System.Web.UI.UserControl
{

    private int _CMSID;
    public int intCMSID
    {
        get { return this._CMSID; }
        set { this._CMSID = value; }
    }
    
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            LoadCMSContent();
        }
    }
    private void LoadCMSContent()
    {
        CMS iCMS = CMS.GetCMS(intCMSID);
        fckContent.Value = Server.HtmlDecode(iCMS.CMSContent);
    }

    protected void Create_Click(object sender, ImageClickEventArgs e)
    {
        try
        {

            CMS iCMS = CMS.GetCMS(intCMSID);
            //iCMS.CMSType = CMSType.ContactUs;
            iCMS.CMSContent = fckContent.Value;
            if (iCMS.CMSId == 0)
            {
                iCMS.Create();
            }
            else
            {
                iCMS.Update();
            }



            uccResponseMessage.SetSuccessMessage("Information Updated Successfully!");
        }
        catch
        {
            uccResponseMessage.SetFailMessage("Failed");
        }
    }
}
